/* GUI CONVERTED from reoprp24.p (converter v1.75) Sat Aug 12 23:07:01 2000 */
/* reoprp24.p - DOWNTIME REPORT FROM OPERATIONS                         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* web convert reoprp24.p (converter v1.00) Fri Oct 10 13:57:18 1997 */
/* web tag in reoprp24.p (converter v1.00) Mon Oct 06 14:17:43 1997 */
/*F0PN*/ /*K14S*/ /*                                                    */
/*V8:ConvertMode=FullGUIReport                                 */
/* REVISION: 1.0      LAST MODIFIED: 02/10/87   BY: EMB *A9*            */
/* REVISION: 2.0      LAST MODIFIED: 05/26/87   BY: EMB                 */
/* REVISION: 2.0      LAST MODIFIED: 08/14/87   BY: EMB                 */
/* REVISION: 6.0      LAST MODIFIED: 07/23/91   BY: bjb *D782*          */
/* REVISION: 7.3      LAST MODIFIED: 03/14/95   BY: pcd *G0HH*          */
/*                                   04/06/95   BY: srk *G0KC*          */
/*                                   12/12/95   BY: jym *G1G3*          */
/*                                   04/03/96   BY: jym *G1S7*          */
/* REVISION: 8.6      LAST MODIFIED: 10/22/97   BY: ays *K14S*          */

/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb              */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

         {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE reoprp24_p_1 "Enable New Repetitive"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/*D782*/ define new global shared variable global_rsntyp like rsn_type.

         define variable part like pt_part.
         define variable part1 like pt_part.
/*G1S7*         define variable ptgroup like pt_group. */
/*G1S7*         define variable group1 like pt_group. */
         define variable opdate like op_date.
         define variable opdate1 like op_date.
         define variable emp like op_emp.
         define variable emp1 like op_emp.
         define variable rsn like op_rsn.
         define variable rsn1 like op_rsn.
         define variable desc1 like pt_desc1.
/*G1S7*         define variable ytd_prod as decimal format "->>>,>>>,>>9". */
         define variable name like ad_name.
         define variable down_desc like rsn_desc.
         define variable shift like op_shift.
/*G0HH*/ define variable rpc_using_new  like mfc_logical
                                                label {&reoprp24_p_1}.
/*G0HH*/ define variable down_rsn       like op_rsn.

         opdate = date(month(today),1,year(today)).

         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
emp     colon 15
            emp1    label {t001.i} colon 49 skip
            part    colon 15
            part1   label {t001.i} colon 49 skip
            opdate  colon 15
            opdate1 label {t001.i} colon 49 skip
            rsn     colon 15
            rsn1    label {t001.i} colon 49 skip
            shift   colon 15
          SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).

/*D782*/ global_rsntyp = "downtime".

/*G0HH*/ find mfc_ctrl where mfc_field = "rpc_using_new"
                    no-lock no-error.
/*G1G3*/ if not available mfc_ctrl then rpc_using_new = no.
/*G1G3*/ else
/*G0HH*/ rpc_using_new = mfc_logical.
/*G0HH**K14S* form with frame rfoot. */
/*K14S*/ FORM /*GUI*/  with STREAM-IO /*GUI*/  frame rfoot width 132.

/*K14S*/ {wbrp01.i}
        
/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

            if emp1    = hi_char  then emp1 = "".
/*G1S7*            if group1  = hi_char  then group1 = "". */
            if opdate  = low_date then opdate = ?.
            if opdate1 = hi_date  then opdate1 = ?.
            if part1   = hi_char  then part1 = "".
            if rsn1   = hi_char  then rsn1 = "".

/*K14S*/ if c-application-mode <> 'web' then
        
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K14S*/ {wbrp06.i &command = update &fields = "  emp emp1 part part1 opdate
        opdate1 rsn rsn1 shift" &frm = "a"}

/*K14S*/ if (c-application-mode <> 'web') or
/*K14S*/ (c-application-mode = 'web' and
/*K14S*/ (c-web-request begins 'data')) then do:

/*A175 CREATE BATCH INPUT STRING */
/*A175*/ bcdparm = "".
/*A175*/ {mfquoter.i emp    }
/*A175*/ {mfquoter.i emp1   }
/*A175*/ {mfquoter.i part   }
/*A175*/ {mfquoter.i part1  }
/*A175*/ {mfquoter.i opdate }
/*A175*/ {mfquoter.i opdate1}
/*A175*/ {mfquoter.i rsn    }
/*A175*/ {mfquoter.i rsn1   }
/*A175*/ {mfquoter.i shift  }

            if emp1    = "" then emp1    = hi_char.
/*G1S7*            if group1  = "" then group1  = hi_char. */
            if opdate  = ?  then opdate  = low_date.
            if opdate1 = ?  then opdate1 = hi_date.
            if part1   = "" then part1   = hi_char.
            if rsn1    = "" then rsn1   = hi_char.

/*A175*/
/*K14S*/ end.

            /* SELECT PRINTER  */
            
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:
find mfc_ctrl where mfc_field = "rpc_using_new"
                    no-lock no-error.




            {mfphead.i}

/*G1S7* * * BEGIN COMMENT OUT * * *
.            if shift > "" then do:
.               form header "Shift:"  at 61 shift
.               with frame shift width 132 page-top no-attr-space.
.               view frame shift.
.            end.
**G1S7* * * END COMMENT OUT */

/*G0HH*/ /* Begin */

         if rpc_using_new then do:

/*G1S7*/   {gprun.i ""reorp24a.p""
             "(input part,
               input part1,
               input opdate,
               input opdate1,
               input emp,
               input emp1,
               input rsn,
               input rsn1,
               input shift)"}
/*G1S7* * * MOVED TO reorp24a.p * *
.            /* ADVANCED REPETITIVE FUCNTIONALITY */
.            for each op_hist where op_part >= part and op_part <= part1
.            and (op_date >= opdate and op_date <= opdate1)
.            and (op_emp >= emp and op_emp <= emp1)
.            and (op__chr01 >= rsn and op__chr01 <= rsn1)
.            and op_type = "DOWNTIME"
.            and (op_shift = shift or shift = "")
.            use-index op_date
.            no-lock
.            break by op__chr01 by op_part by op_date by op_emp
.            with frame b1 width 132 no-attr-space:
.
.                 if first-of(op__chr01) then do with frame b1:
.                    down_desc = "".
.                    find rsn_ref where rsn_type = "downtime"
.                    and rsn_code = op__chr01 no-lock no-error.
.                    if available rsn_ref then
.                       down_desc = rsn_desc.
.
.                    down_rsn = op__chr01.
.                    display down_rsn down_desc.
.                 end.
.
.                 if first-of(op_part) then display op_part.
.
.                 if first-of(op_date) then display op_date.
.
.                 accumulate op_act_run (total by op__chr01).
.
.                 name = "".
.                 find emp_mstr where emp_addr = op_emp no-lock no-error.
.                 if available emp_mstr then name = emp_fname + " " + emp_lname.
.
.                 display op_emp name format "x(24)".
.
.                 find ro_det where ro_routing = op_part and ro_op = op_wo_op
.                 no-lock no-error.
.                 if available ro_det then display ro_desc column-label
.                   "Operation".
.
.                 display op_act_run column-label "Downtime" format "->>>9.999".
.
.                 if last-of(op__chr01) then do with frame b1:
.                    down 1.
.                    display fill("-",10) format "x(9)" @ op_act_run
.                    column-label "Downtime".
.                    down 1.
.                    display "               Total" @ ro_desc
.                    (accum total by op__chr01 op_act_run) @ op_act_run
.                    column-label "Downtime".
.                    down 1.
.                 end.
.
.                 if last(op__chr01) then do with frame b1:
.                    down 1.
.                    display "        Report Total" @ ro_desc
.                   (accum total op_act_run) @ op_act_run
.                   column-label "Downtime".
.                end.
.
.               {mfrpexit.i}
.            end.
.
./*G0KC*
.*  /* REPORT TRAILER */
.*  {mfrtrail.i}
.**G0KC*/
.
**G1S7* * * END DELETED SECTION */
         end. /* if rpc_using_new */
         else do:

/*G1S7*/   {gprun.i ""reorp24b.p""
             "(input part,
               input part1,
               input opdate,
               input opdate1,
               input emp,
               input emp1,
               input rsn,
               input rsn1,
               input shift)"}

/*G1S7* * * MOVED TO reorp24b.p * * *
.            /* OLD REPETITIVE FUNCTIONALITY */
.            for each op_hist where op_part >= part and op_part <= part1
.            and (op_date >= opdate and op_date <= opdate1)
.            and (op_emp >= emp and op_emp <= emp1)
.            and (op_rsn >= rsn and op_rsn <= rsn1)
.            and op_type = "DOWNTIME"
.            and (op_shift = shift or shift = "")
./*G0HH*     use-index op_type */
./*G0HH*/    use-index op_date
.            no-lock break by op_rsn by op_part by op_date by op_emp
.            with frame b width 132 no-attr-space:
.
.                 if first-of(op_rsn) then do with frame b:
.                    down_desc = "".
.                    find rsn_ref where rsn_type = "downtime"
.                    and rsn_code = op_rsn no-lock no-error.
.                    if available rsn_ref then down_desc = rsn_desc.
.                    display op_rsn down_desc.
.                 end.
.
.                 if first-of(op_part) then display op_part.
.
.                 if first-of(op_date) then display op_date.
.
.                 accumulate op_act_run (total by op_rsn).
.
.                 name = "".
.                 find emp_mstr where emp_addr = op_emp no-lock no-error.
.                 if available emp_mstr then name = emp_fname + " " + emp_lname.
.
.                 display op_emp name format "x(24)".
.
.                 find ro_det where ro_routing = op_part and ro_op = op_wo_op
.                 no-lock no-error.
.                 if available ro_det then display ro_desc column-label
."Operati~ on".
.
.                 display op_act_run column-label "Downtime" format "->>>9.999".
.
.                 if last-of(op_rsn) then do with frame b:
.                    down 1.
.                    display fill("-",10) format "x(9)" @ op_act_run
.                    column-label "Downtime".
.                    down 1.
.                    display "               Total" @ ro_desc
.                    (accum total by op_rsn op_act_run) @ op_act_run
.                   column-label "Downtime".
.                   down 1.
.                 end.
.
.                 if last(op_rsn) then do with frame b:
.                    down 1.
.                    display "        Report Total" @ ro_desc
.                    (accum total op_act_run) @ op_act_run
.                    column-label "Downtime".
.                 end.
.
.               {mfrpexit.i}
.            end.
.
./*G0KC*
. *  /* REPORT TRAILER */
. *  {mfrtrail.i}
. *G0KC*/
.
**G1S7* * * END DELETED SECTION */
         end. /* std. repetitive */

/*G0KC*/ /*REPORT TRAILER*/
/*G0KC*/ 
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


/*G0HH*/ /* End */

         end. /* repeat */

/*K14S*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" emp emp1 part part1 opdate opdate1 rsn rsn1 shift "} /*Drive the Report*/
